<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:include="~{common/header :: commonHead}">
    <title>编辑活动奖项</title>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5 th:text="${null == editable ? '添加奖项' : '编辑奖项'}"></h5>
                    <div class="ibox-tools">
                    </div>
                </div>

                <div class="ibox-content">
                    <form class="row form-body form-horizontal m-t" method="post"
                          th:action="${null == editable ? '/marketActivity/scratchCard/addGift' : '/marketActivity/scratchCard/addGift'}">
                        <input name="id" th:value="${editable?.id}" style="display: none">
                        <input name="scratchCardId" th:value="${scratchCardId}" style="display: none">
                        <div class="col-md-12 droppable sortable ui-droppable ui-sortable">
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">奖项名称：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="name" class="form-control"
                                           th:value="${editable?.name }" required="required" placeholder="请输入奖项名称">
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">优惠券：</label>
                                <div class="col-sm-6">
                                    <input type="hidden" th:name="${null != editable ? 'couponId' : ''}" th:value="${editable?.couponId}">
                                    <select th:disabled="${null != editable}" class="form-control" id="coupon-selector" name="couponId" required="required">
                                        <option value="">请选择优惠券</option>
                                        <option th:each="couponDTO : ${couponList}"
                                                th:selected="${couponDTO.id == (editable?.couponId)}"
                                                th:value="${couponDTO.id}"
                                                th:text="${couponDTO.name}"></option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">单次发券数量：</label>
                                <div class="col-sm-6">
                                    <input type="text"  name="sendCount" class="form-control" th:value="${editable?.sendCount }" required="required" placeholder="请输入单次发券数量">
                                </div>
                            </div>
                            <div th:if="${null != editable}" class="form-group draggable ui-draggable dropped"
                                 style="position: static;">
                                <label class="col-sm-3 control-label">创建时间：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="createTime" required="required" class="form-control" th:value="${editable?.createTime}" disabled>
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped"  style="position: static;">
                                <label class="col-sm-3 control-label">开始时间：</label>
                                <div class="col-sm-2">
                                    <div class="input-group date">
                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        <input type="text" class="form-control" readonly placeholder="开始时间" id="buy_time_start" th:value="${editable?.startTime}" name="startTime" required>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">结束时间：</label>
                                <div class="col-sm-2">
                                    <div class="input-group date">
                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        <input type="text" class="form-control" th:value="${editable?.endTime }" readonly placeholder="结束时间" id="buy_time_end" name="endTime" required="required">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">总库存：</label>
                                <div class="col-sm-6">
                                    <input type="text" th:if="${null == editable}" name="sumTotal" class="form-control" th:value="${editable?.sumTotal }" required="required" placeholder="请输入奖项库存">
                                    <input type="text" th:if="${null != editable}" readonly name="sumTotal" class="form-control" th:value="${editable?.sumTotal }" required="required" placeholder="请输入奖项库存">
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">概率：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="odds" class="form-control"
                                           th:value="${editable?.odds }" required="required" placeholder="请输入奖项概率(100以内正整数)">
                                </div>
                            </div>
                            <div class="form-group draggable ui-draggable dropped" style="position: static;">
                                <label class="col-sm-3 control-label">是否上架：</label>
                                <div class="col-sm-6">
                                    <label class="radio-inline">
                                        <input type="radio" th:checked="${editable?.status == 1}" value="1"
                                               name="status">是
                                    </label>
                                    <label class="radio-inline">
                                        <input type="radio" th:checked="${editable?.status == 0}" value="0"
                                               name="status">否
                                    </label>
                                </div>
                            </div>

                            <div class="hr-line-dashed"></div>

                            <div class="form-group draggable ui-draggable">
                                <div class="col-sm-12 col-sm-offset-3">
                                    <button class="btn btn-primary" type="submit">保存内容</button>
                                </div>
                            </div>

                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>